package com.mf.springcloud.service;

import com.mf.springcloud.entity.Article;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public class ArticleClientServiceFallbackFactory implements FallbackFactory<ArticleClientService> {

    @Override
    public ArticleClientService create(Throwable throwable) {
        return new ArticleClientService(){
            @Override
            public Article get(Integer id) {
                return new Article().setId(id).setDb("no this db").setDescription("查找不到对应ID数据");
            }

            @Override
            public boolean add(Article article) {
                return false;
            }

            @Override
            public List<Article> list() {
                return null;
            }
        };
    }
}
